﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DAL;
using DomainModel;

namespace BL
{
    public static class BLTv
    {
        //Get the display types
        //public static Dictionary<int, string> GetDisplay(ref List<string> errors)
        public static Dictionary<int, string> GetDisplay(ref List<string> errors)
        {
            return DALTv.GetDisplay(ref errors);
        }

        //Get the make types
        public static Dictionary<int, string> GetMake(ref List<string> errors)
        {
            return DALTv.GetMake(ref errors);
        }

        //Get the refresh types
        public static Dictionary<int, int> GetRefresh(ref List<string> errors)
        {
            return DALTv.GetRefresh(ref errors);
        }

        //Get the resolution types
        public static Dictionary<int, int> GetResolution(ref List<string> errors)
        {
            return DALTv.GetResolution(ref errors);
        }

        //Get the size types
        public static Dictionary<int, int> GetSize(ref List<string> errors)
        {
            return DALTv.GetSize(ref errors);
        }

        //get price of product
        public static double GetProductPrice(int id, ref List<string> errors)
        {
            return DALTv.GetProductPrice(id, ref errors);
        }

        //returns the item searched for
        public static List<Product> SearchItem(int display, int make, int size, ref List<string> errors)
        {
            //checks if display type exists
            if (display < 0)
            {
                BLMsgPool.ErrorCapsule(4, 1, ref errors);
                return null;
            }
            //checks if make type exists
            if (make < 0)
            {
                BLMsgPool.ErrorCapsule(4, 2, ref errors);
                return null;
            }
            //checks if size type exists
            if (size < 0)
            {
                BLMsgPool.ErrorCapsule(4, 3, ref errors);
                return null;
            }
            return DALTv.SearchItem(display, make, size, ref errors);
        }

        /*for 3 methods for partial view function*/
        public static int numberOutOfStock(ref List<string> errors)
        {
            return DALTv.numberOutOfStock(ref  errors);
        }

        public static List<Product> GetTopFive(ref List<string> errors)
        {
            return DALTv.GetTopFive(ref errors);
        }

        public static List<Product> GetOutStockDetail(ref List<string> errors) 
        {
            return DALTv.GetOutStockDetail(ref errors);
        }
        ///// END OF THREE METHODS
    }
}
